Simplify js; remove some css duplication