Finally a working solution, and now I need a drink