removed repeated code