merged and a few small changes made