replaced if to switch
performance fix
performance fix for bulitin_port
rewrite procedue.cc