Automated application of design patterns : a refactoring approach