Refactor; Fix warnings; Chage comments