added function level doc block and comments