Ain't pretty, but it works