rect remove bugfix, general cleanup