Refactor/generic loader