fixed multiple bugs,added docs, and more