Manhattan implementation