Incorporated fixes from #23