converted to require js
refactor state, requirejs implemented
more state