Minor function re-ordering