Change type of UserData to map. Fix general issues