refactor update/render/handle_events