refactor few code