changed type hierarchy, moved all user type definition into a single file and improved write code