more general load function