Added -h and -v flags plus other small improvements