Only count arguments
Added flag parsing code
Cleaned up formatting