[RSDF] Improve code a bit (thx charlie89)