Some tidying of functions