moved functions into classes