Steps that run through the hw3 algorithm