js class to avoid scoping issues