Merged load, loadAll and loadArray in one function.