Clean up time handling and adjust permissions