Refactored coordinateToInt with separate functions for checking for valid coordinates…