better typing errors and more documentation