Refactor most of functions to have default layout and have clean codes