split noise generation code to a separate module
shuffle around the code