Closes #11 plus tests