general idea + testing C-code