two methods added and code improvements