Modernised code

Depreciated stuff, brought it up to speed