started to write -R, now compiles, but segfaults
removed old code, starting to rewrite