Fixed 404 error
Tidied up event code