Added check for whether the column bounds are exceeded.
Added macros for directions