cleaned up manuscript code