Various fixes to improve speed and compatibility with already-written Arduino programs