rewrote to allow options