Implement validity check to square