events and states are now properties, code cleanup
Renamed device "properties" to "attributes"