Added action handling function to exits onclick handler