Cleaned up square code