refactoring for better OCP, also fixed image loading issue