Added door sensing code