refactoring

refactored repetitive part of title into let function