You can tinker with the command it does work for 1.8x but it may not work for 1.9 this has a bit of bugs but it will work if you do it right ! (and use a commandblock)
The command
Note: Minify the command to avoid issues :)
Created: Thu, 26 Nov 2015 14:17:48, Updated: Sun, 12 Feb 2017 01:38:31, Views: 18