Added comments to main functions of three tiers