reorg and clean up models code