refactor code in one object wrapper