removed the if's

the if's can be rewritten by using javascript stdlib