Add error handling and stuff