more speedup and refactoring