fixing errors and adding features