add in/out bundle manifest handling, add options n N c, refactoring & bugfixes