Tidy up, optimizations