Restructured to allow for preprocessing
Added instruction merging