moved functions into object

example