Edited my comments for the solution