general cleanup and many changes made