move function into class