Better way of doing it (thanks @rynclark)