Extensive cleanup to remove all buggy or non-working code