Clean siv implementation a little removing duplicate code