show_time optimization, code refactoring