Local uploads working + some code improvements