Add time functions, simplify API