put functions into object
use this
code refactor