Collected needed code from other project