add tests; remove obsolete code
add tests; remove obsolete code