rewrite the whole class