added prioriry_queue and done some other small mods