removed dialog, some small changes here and there to make sure things are called only when needed