rewriting with more convenient screen drawing