Shuffle some functions to make the code more clear