Added global clock, major modifications