Issue #17 refactor