Code cleanup, moved getPosition() and getTypeName() to rest.js