implement scope and improve 'value'