Switched to using whatapi directly, instead of just stealing code from it.
Wrapped opening config/state files in try-except blocks.