refactor image class