Added external_input and other significant changes