some changes to global functions