Pushed externs to globals. Added start of terminal code. Bug in log() so temporarily commented out.