version 0.0.2: re-implemented as a object-oriented style