added boilerplates and basic control flow.