Added Tests and minor changes.