WHISTLE-1186: cleanup ets table on terminate

WHISTLE-1186: formatting and refactoring