Intermdiate code towards a working version ( Dirty ) [till 2nd switch]