Made uppercase function more efficient