added language selection and fixed bugs