UPDATE: minor code cleaning and major documentation updates