Some bugs fixed, added the initializing phase