Refactor command line argument parsing
Fix style error with else statement on wrong line
Change mode bucket count logic to be more javascripty