fix rendering
big refactoring