- placed phi_handler into the be_main environment, removing unnecessary allocations