shorter version thanks to Alex Rauschmayer hint