Refactor board js