Refactor packet sending and added pattern settings