improved javascript deck structure