refactor to use instances of rack