optimised a little