functions are now created only once and passed a scope later