refactoring + test + prototype