Object Oriented Javascript helper functions