added clearInactive method, and made comments prettier