Fixed the maintain function