simplify and remove more code