Code tidying up and RSPEC reworking