added error messages to Time constructor and cleaned up code