CodeIgniter 2 Version of the code (in progress)