fix some bugs; implement oo concept