Reorganize file structure, fix warnings