Issue177 gem refactor

see #177