Added better boundary checking for obstacles and make obstacles easier to test on.