streamlined code a little bit