Fixing deprecated calls and cleaning up stuff