added exercises and a bit of refactoring