Implementation of #11
Implemented #6 and #7