rearrange file structure; minor fixes to csm.c