Rebased against codeignighter