Removed unused imports and some variables, updated Deprecated code, more fixes