5. Revocation; modification; continuation. At the conclusion of the hearing the court may revoke, continue or modify the sentence of probation or conditional discharge. Where the court revokes the sentence, it must impose sentence as specified in subdivisions three and four of section 60.01 of the penal law. Where the court continues or modifies the sentence, it must vacate the declaration of delinquency and direct that the defendant be released. If the alleged violation is sustained and the court continues or modifies the sentence, it may extend the sentence up to the period of interruption specified in subdivision two of section 65.15 of the penal law, but any time spent in custody in any correctional institution pursuant to section 410.60 of this article shall be credited against the term of the sentence. Provided further, where the alleged violation is sustained and the court continues or modifies the sentence, the court may also extend the remaining period of probation up to the maximum term authorized by section 65.00 of the penal law. Provided, however, a defendant shall receive credit for the time during which he or she was supervised under the original probation sentence prior to any declaration of delinquency and for any time spent in custody pursuant to this article for an alleged violation of probation.