minor code cleanup and preperations