This should work for now.

I know, the code doesn't look nice.