fixed many bugs

uses atoms instead of indices now...less mutable woooo