can you do this: http://stackoverflow.com/a/14407716/2551908 and avoid the repetition?