Added functionality and tests for requirements B and C