added initialize code and fixed test