Refactor some useless code