Split into two function as opposed to all in main