Added valid square finding functinos.