updated checking algorithm and coordinates