Refactored haskell code a bit + added primitive cmd arguments handling