Surrounding Function Patch

Made updates to the surrounding functions to take into account sides.
Still a problem with the bottom row though..