reorganized code + new code