Lots of code fixes.
Updated to 13w09c