refactored passing of certain objects and added some commets