Cleanup and bugfixes. GNU is scary.