Refactor feedback lib, and added tests