improved the code formatting, documentation; removed code that was commented