continued refactoring to split UI and draw library