try to do as much as junk code and as many possibilities of coding for a solution. Don't try with one solution and remove it if not working. just comment it and try with some other solution. so that once the code is working fine then clean the code before making it to production.