Dead code removal & warning fixes