added some debug logging, implemented time slicing, faster now