move declaration to top of block