Cleaned up the JS a bit more and added the selection piece back