kernel: Extract timout code to its own file, add comments