applied formatting, ignored draw() when idx is <= 0, used better naming convention