Cleaned up data types / added mechanism to bind to threads