More features added to main function