Added documentation comments and pulled out reusable code into separate files