Cleaned up code. Can record 30KB of data on battery.