added the nut and refactored a bit