swapped events and code styles