Add user data to tree store and refactor sorting routines