Proposed solution for first test assignment. There is no guarantee for completeness and/or correctness :-). But studying the code is still worthwhile!