Added opmode, removed excess code