Refactoring - remove code duplicates