remove extra logging and simplify javascript