Porting some nice code cleaning from Philip (http://git.manjaro.org/core/thus/commit/2055c671dcaa737184ed70ba03dba835749c8af7#a7da638518d167abaef0484d2dd58fd6b2b4588f_42_41)
Not finished.