Added more changes from Pull #3