a few lines tweaked