restructure and cleanup