moved functions into a class