finished but need to check for bugs