Use static method for factory
Fix style issues