Background tasks

WIP

See #15 and #44