cleanup code; minor changes