yanked out the model out of index and clean up the code