Intial working code.