Implement more opcodes, minor improvements