Added Tests, some minor improvements