removes unused code and rearranges files