Added delete functionality.
Fixed various bugs and made it work with python 2 & 3