Adding tests
Fixed errors