Minor code clean up

Cleaned up the JS so it's in line with the existing design pattern