Rect gen refactoring complete