fixed up the -u flag stuff and added almost all the required building blocks