refactored fixTitle into separate function