Some refactoring.

Closes #15 and #20.
The #20 will be useless after pack the project as a gem and build some generators, i will delay it for now and clean some code instead.