Implement some new routines, and fix a few offset-related issues.