implementing the four loop