split into multiple files; some more comments