Updated the code to support touch sensors