Khanload refactor

Moving central khanload code out of distributed and into central repository