Simplify types and improve comments