Turned the function that does reload into a class, tried to make everything a bit clearer. Also added a bit of error checking.