Imported existing code.