events and states are now properties, code cleanup
Renamed device "properties" to "attributes"
typo fix and call to constructor