added updated code from Romeo and his light sensor guide