Changed some exception handling, still not completely working