cleaned up code, though still needs author attributes.