Fixing remaining warnings and errors throughout