Restructured code, implemented skeleton