added documentation and testing