#3 implemented and tested