Refactoring: group code
Delete unused tests
Fix unit tests in search
Fix unit tests in flow network