Refactor coordinates function to use map