added Archit's code. Don't copy paste, it's totally fuckedup