code refactor and two fan support