Removed some more compiler warnings around application handlers and tidied up some code.