slight re-factoring