adding real overloads

we don't need to do any dynamic_casts if the input is already of the
correct type
adding some assertions after dynamic_cast
reorder template parameters

those with default values should be placed at the end