Bug/182 2

Took another approach in fixing #182. This should do the trick.