Combining functions into main