extracted parts from main file for calrity