added empty list test, refactor profiling code to return results