hw 4

rec implemented with tests