refactor to share init and in preparation to use hunit