Almost finished refactoring, some bugs remaining. Two sides are now rendering.