Ain't pretty but works