create clustering functions and title formatting