This fixes #19 and resolves #40