Added noise function and square wave function