Add clock in/out logic and tests