Added check for negative coordinates