refactor code stable version