fix bugs; refactoring; implement psp; begin to give structure to memory; various improvements