Refactor: drawing to more functional code