using type assertions instead of reflection