added more functions and story to the main code