Reversed order of block storing in result (y then x) and added two catch clauses to catch out of bounds errors