Changed reference to this instead of window object