added prime optimization and histogram interactions