Separating some logic to make a cleaner package