apportable's refactor and memory leak fixes