adding blur effect and refactoring to avoid duplication of code