cleaned up code, edit section still not working correctly.