Added unique character checking algorithm