Added script timing and main function.