Move external functions to class