refactoring and commenting done
Will and Emily Merge