Modified for our use case.