Fixes #97, refactor utils/