Added command classes

Also implemented command classes in test.js and fixed 'switch' with
parseInt().