Remove unnecessary casts.
Fix up the stack structure a bit.

s/instructions/locations and change the type to []uint16 to avoid casting stuff back and forth.