If by "icky" you mean "unmaintainable spaghetti", I have to agree ;)
I suggest to move the second block to Application.cpp, as suggested, but leave the first one here.