typos, better matrix building
better cmd argument handling