All the good stuff here!
Your javascript in a neater way, more than a function, less than a traditional OOP class.