profiling and problem with sorting