The basic structure is done. A lot of TODO need to be fixed.