Cleanup, removed non needed materia, and abstracted query and resend
management out of the lib.