abstracted out functonality and added a null flag