added better documentation; updated tests