speed up the implementation