added clock
with lots of bug fixes after testing by Benjamin and Joseph :)