Refactor Cap FIle