added pipes and shared memory
added some safety measures