Added error handling to BgTask and updated documentation