Lots of changes for performance