cleanup comments etc and restructure plugins