updated derived file
simplified condition variables
fixed jslint errors