file structure reorg and slight style improvements