Added handle_models_in_dir method and refactoring to avoid duplication