More changes and a major cleanup

Also a wave output setup