refactor class loading