Replace functions with class functions