Code cleanup and file structuring improvements.