Refactor image model