Generalize simple register to allow easier creation of target languages
Fix js for pretty print