Refactored model into layers