Fixed and cleaned up for first try.