Implement changes from cm11 branch