Revert "Updates from CM10"

This reverts commit 134fe58d2ba89dc19495370b634e878a33191c5f.
Huge cleanup and bugfix