Correct some bugs, refactor two methods to more readable and it's all