Merge "Remove unused code and fix warnings" into main