Body of the main functions already finished