Full working solution