Adding better logic to 'look-before-leap' method.