improved harvest middleware
remove unused code