Refactored ApplyModel. I think it is faster and cleaner.