Bug277 cjdlua refactor

Break cjdlua into a group of files as per #277.