extracted get code methods out for simplification
fixed up has output ethod