move code under main; fix time locale