restructured code layout