refactoring, debugging, fixing some render issues