Added code for kgamma_b, kgamma_apply and cleanup

Signed-off-by: Daniel Tarrant <daniel.g.tarrant@gmail.com>