Fixed the memory leak, the clean code will come soon