Added loop to solve corners function