Add support for destdir option.

- Also some very basic input validation
Lol I don't think this code is ugly and stupid anymore :+1: