Splitting up functions in main