Properly parse properties from the command line

Unfortunately, a lot of code had to be copied from HscMain