Refactoring of model to allow multithreaded optimization