I imagine that you can and should refactor away 90% of this file.