[Refactor] Refactoring the project according to design written in onenote. Problem is that i trying to find a way to let js wait a function completed