Functions modified and errors removed