bug fix: memory leaks
refactor js
refactor