little optimizations to the obstacles handling