I rewrote this to be like you suggested.