almost everything rewrited with class file