do some refactor, Make usage more ruby-style.