refactoring download functionality

Signed-off-by: Ondrej Rafaj <ondrej.rafaj@fuerteint.com>