Some refactors I noticed

@juanxo: ping.