Rewrote runtime layer to try and fix offset bugs.