Cleaned up SpaceMap code