Cleanup to allow flags to be used