modified function register