refactor treasure controller