implemented all functions
made drawing work