small changes, coding style changes

changed most function from explicit script local to default