refactor to can run on local

refactor code