Added basic Tests

Some minor bug fixes