Removed unneeded imports and fixed deprecated function calls