I changed the implementation. I hope its clear like this.