This is just a small thing, but instead of using:
set %h
It might be better to set a local variable:
var %h