First implementation of profile() and simple_profile()