code-refactoring  and adding some imags