added scope and log functions