Cleanup and fixes of the source tree