Final commit with restructured code.