Refactor Some Part of Code