convert functions to class