moved functions to inside obj