added more comments - possible areas for refactoring