started to rewrite draw function from scratch