all logic (execpt for local) converted to go. need to fix regex