Initial code commit - working

Earlier version with chunked smoothing