Adjusted bahvior to fit PS, added tests