Fixed bugs, added testing comments