Optimized kernel calculation a bit

Lots of unused variables and calculations. Got rid of ‘em!
Made hfac a global variable so that it only has to be defined once.