Added tests + small fixes #PLY-59