Restructured and renamed functions