Rough implementation for manhattan.