Ehnanced code for 'last' event