Cleaned up map logic