Even more error handling
Move io into separate file
Switch to libgio for file io