Complete tutorial part 5

Code some tests for the application logic and solve some problems with that