Replaced deprecated functions with well-structured alternatives.