Add more documentation and tests