Ashok | Refactoring: Moved into logical, reusable methods | Added a pattern background.