Improvements to conditional logic JS

Signed-off-by: Elliot Condon <e@elliotcondon.com>