renamed tests, cleaned up main code