Refactor code

Fixes #19.
I was meaning to change that :+1: