more changes to structure, added stylus support