adding background detection