Further refactoring and new files.