moved the printing of the rhs into it's own function