ugly solution as usual