abstracted functions into classes