working check boundaries