added theoretically working copy, testing and debugging still left