Add comments and simplify