added all of jrdbnsn's changes