refactor helpers and move ipc to modules