small changes to speed it up