few minor code optimisations