Re-organizing code, more cleanup.