Issue fixes

* fix issue 6
* split statements.rb into two parts and refactor the whole code