reorganize things:function definition at the bottom