Fixed some syntax errors, ready for debugging
Fixed error in tick handler