Add block scoping and remove some warnings