some minor fixes and rearrangement; added Time module