done but has a bug with exit