Move domain and io into packages