Some refactors I noticed when reading through the code.