changed components to take repository as function parameter instead of constructor parameter