working, fixed errors