Added functions to main