Separation of draw and main functionalities.