added more documentation and tests