Adding generic clock code