Changed up some event handling

Added more if-statements for event handling. Not completed yet.