Added additional tests fixed bugs