added unload and sendquery functions