Resolve warnings, remove unused code