adding javascript file
generalizing, DRY
styling