Updated version with foscam support