Added basic code, the example is now working
Added signal handling

If SIGTERM or SIGINT are recieved during the task run, it will jump to
the cleanups. Signal handling during any other parts of the code is same as
always.