added unit testing; debugging currently