move declaration to the beginning of a block