adjust to changed api
cleanup and documentation