reorganized code
misc