Added pulse sensor, which sort of works, and improved the script.