Map now yields a result, and refactored the code.