Revisions to code

As discussed during Skype call