Changed checkDuplicates to isRegistered, removed a few unnecessary declarations, and edited a few lines for aesthetics