wrote all functions except display stuff; need to update opcode switching as well