added command line options for everything + code reorganisation

now arguments are taken in the "parameter:value" form, with no fixed
order, and there's a bit of error recognition. Also, comment blocks
have been inserted.