Added 7 refactors or bug fixes