streamlined some logic