(#802) - adding purge

First approximation of purge feature. Will have to add error handling and other stuff + I have no idea why my test fails (works on node shell).