simplify and document