Simplify and clean up more code