refactoring for berkley hackthon