Fix some warnings and deprecated method calls. Now actually works.