pseudo code and initial code finished