Fixed #59, tests added.