updated foctory tests and refactored tests