Format code and add constructor