Initial trainer code + csvjoin fixes