Another approach http://stackoverflow.com/questions/19674101