Moved most of the logic in Default.aspx.cs to a controller.