Major refactoring to remove prescribed classes

Refactored state.js and examples
Added map() to oldie.js