added asRectangle method, and started working on partitioning algorithm