refined code and added basic tests for recommendations