Created a package usable from SBT, improved externs, fixed some bugs, etc