Could probably be condensed further, but looks functional as-is.