refactoring to separate simulation and rendering