splitting functionality abstracted into a class