Added in redirect functionality and fixed event handling