Moved functions into class