Updated with the clearer code