Various cleanups in Foundation. (#289)