Bring project layout up to date. Also remove some duplicate code.