Various cleanups as suggested by Remi Denis-Courmont