Tests added and some fixes for the onion part.