Refactored code due to CR: separate function for parsing of coordinates