updated. Added tests