Part of the fixes according to Paul's review