extract code for further usage