cleanup code and switch to .slice for v8 perf