checkpoint - some restructuring of code and new code