Clean up. First real working version.