Added Factory Pattern & more unit tests