Added test and fixed normalisation
Moved command-line options to be reusable