major refactoring of code, including the use of new heartbeat timer
which makes the logic of the handoff of delayed functions a lot easier.