refactor and reorganize some misc. files