Tidying

Made changes to code so that it reads in a logical order. Combined functions to make usage more user-friendly in just one step.