Javascript refactoring + Frontend visibility Heating