streamlined the code