add logging, add testing, clip properly