Cleaned up population code