implemented factory injection