Overhaul code to utilize CodeIgniter