Cleaned up loadmap function