edited based on comments