move declarations to the beginning of blocks