Stackoverflow contributions added.