Added some validation and sanitisation of sz and id params.