Main Page code cleanup