more enegant way of fixing #6, closes #7 and closes #6