rectangle calculation cleanup