added finishing touhes and tests