Both tenses refer to actions in the past. The preterite is used to describe actions in the past that have been completed. Exampe: Fuí al baile anoche- I went to the dance last night. The verb ir is in the preterite form because the action is in the past and has been completed. The imperfect describes past actions that occured repeatedly or were ongoing actions that dont't have a definite end. Los chicos hablaban en español- The boys were speaking spanish. The verb hablar-speak is in the imperfect tense the action the boys were speaking spanish they action does not have a definite end they probably still speak spanish.