refactored the comments+added docs with doxygen