placed functions inside scope wrapper