refactor javascript, add css