Refactored js code, finished css. Error in js code