Refactor splitter code to seperate class