Performance improvements + spec fixes