Small fix for issue #537 and refactor to make code more clear.
Small fix for issue #537 and refactor to make code more clear.

git-svn-id: a243b28a2a52d65555a829a95c8c333076d39ae1@3231 44740490-163a-0410-bde0-09ae8108e29a

grnet/simplesamlphp,cwaldbieser/simplesamlphp,grnet/simplesamlphp,ghalse/simplesamlphp,madmatt/simplesamlphp,maytechnet/simplesamlphp,StudentLifeMarketingAndDesign/simplesamlphp,Kunstmaan/simplesamlphp,dialogik/simplesamlphp,simplesamlphp/simplesamlphp,jschlyter/simplesamlphp,girgen/simplesamlphp,dzuelke/simplesamlphp,dialogik/simplesamlphp,Kunstmaan/simplesamlphp,dnmvisser/simplesamlphp,madmatt/simplesamlphp,dialogik/simplesamlphp,ghalse/simplesamlphp,maytechnet/simplesamlphp,BrettMerrick/simplesamlphp,ghalse/simplesamlphp,BrettMerrick/simplesamlphp,gtkrug/simplesamlphp,jschlyter/simplesamlphp,gtkrug/simplesamlphp,dialogik/simplesamlphp,ghalse/simplesamlphp,Kunstmaan/simplesamlphp,simplesamlphp/simplesamlphp,sitya/simplesamlphp,gtkrug/simplesamlphp,simplesamlphp/simplesamlphp,sitya/simplesamlphp,jschlyter/simplesamlphp,girgen/simplesamlphp,dzuelke/simplesamlphp,sylvainmed/simplesamlphp,StudentLifeMarketingAndDesign/simplesamlphp,shoaibali/simplesamlphp,Kunstmaan/simplesamlphp,gtkrug/simplesamlphp,sitya/simplesamlphp,StudentLifeMarketingAndDesign/simplesamlphp,maytechnet/simplesamlphp,dnmvisser/simplesamlphp,dzuelke/simplesamlphp,grnet/simplesamlphp,StudentLifeMarketingAndDesign/simplesamlphp,cwaldbieser/simplesamlphp,jschlyter/simplesamlphp,maytechnet/simplesamlphp,shoaibali/simplesamlphp,madmatt/simplesamlphp,girgen/simplesamlphp,dzuelke/simplesamlphp,simplesamlphp/simplesamlphp,dialogik/simplesamlphp,sylvainmed/simplesamlphp,grnet/simplesamlphp,sylvainmed/simplesamlphp,jschlyter/simplesamlphp,BrettMerrick/simplesamlphp,sitya/simplesamlphp,BrettMerrick/simplesamlphp,cwaldbieser/simplesamlphp,sylvainmed/simplesamlphp,shoaibali/simplesamlphp,girgen/simplesamlphp,shoaibali/simplesamlphp,cwaldbieser/simplesamlphp,girgen/simplesamlphp,dnmvisser/simplesamlphp,dnmvisser/simplesamlphp,madmatt/simplesamlphp