replaced deprecated function calls with newer versions