change main to use object