fixes style nits and accounts for NAN