Ensuring a task only consumes the resources it needs rather than the full offer

also some cleanup.

@guenter please have a look.