Fix bugs and use new listener system