Cleaner implementation

Hi,

I tried to clean up your implementation a bit, so it doesn't change any other structure or influences the interface. Please see if this still works to your likings and let me know what you think about it. Thanks for your contribution in the first place! :+1: