Console. not tested. Based on working solution.