Updated Main File Containing all the functions