extended and renamed function for local codes