Add download module, change installer to use it

Also make some shared static function to function, and
move some utility function around

Change-Id: If7f893fcf9be4f5973ad87576c70417a15488ca4