solved both problems