I have been searching on this topic for sometime till i found this post https://stackoverflow.com/a/17266448/4535386 from ircmaxell, I think it deserves more exposure.