JS test layer

Minor code refactoring