Added code for bounds check optimisations

Currently implmenting methods to check whether an index can be optimised.