Code is now functional instead of all in 'main'