Refined code and renamed "to" with "next" or "square"