Add cleanup function

Also:
* Add getopts parsing
* Do not print 'interupted' on ^C
* Fix bug in end() function
* Update args and usage