Huge code and documentation cleaanup