fixing/prettifying js functions