MOve this code up so that is reused by all the methods.