Add additional option; replace range by xrange
Rewrite frequency test method