remove unused globals
remove double echo