Issue #56 - Igor's fix + refactor