Ported to JS

Fixed issues with Alias, Entry. Mostly clean sheet rewrite of generator
(it was mostly unconverted PHP anyway)