fixed #10

maybe better merge #8, it also eliminates #10, but also introduces some nice features