changed this a little because there was some redundancy