more refactoring

Trying to remove duplicate code... might work on making my "binary uploads itself" thing soon.