memory leak fixed, performance slightly improved, expect added