Add some doc and move code in modules