Changed listeners and code cleanup