applied last changes from butbucket.org/kovisoft/slimv