restructure modules and small fixes