Cleaned up. N database required