optimize square