refactor for erlnode