Improve parsing; clean up code; break out functions; build clean demo