move all function definition to the end