Fixed up Square Generate Function