Support for trihour working

but have a lot of code to clean
Several fixes