Updated Square function to dig if blocks detected before moving