Merged in changes from older CodeIgniter project