some restructuring
TODO and some minor stuff