Some refactoring and setup for task 3