fixed a glitch and added to program