Another solution. Still ugly.