Removing deprecated function calls, general cleanup