Restructured code for future additions.