Add support for trained models directory.
minor reorg.
Fix minor bugs and typos.