Added command line flags
Turned some functions into properties
More / better exception handling