minor code shuffling