Better logging, added some optionas, implemented cleaning