Acceptance tests refactoring. Minor JS fixes