Refactored some of the code - starting to join basic blocks together (?)