Changed logic for coordinates transformation and proper state validation