Refactor reduce file size