added clock border, some code refactor