some more refactoring until ran into renderer bugs