relay: move classes to internal package where appropriate