soloution to problem 001, need to redo with oop