Made my method a little more adaptive.