Rearranged some functions to belong to object prototype.