[refactoring] sorted function order to be a little bit more clean code like