clean up, add log messages, fix delay being set incorrectly