Refactoring and more prototyping