data restructure and general improvements